package com.vhuomai.system.mapper;

import com.vhuomai.mybatis.mapper.auto.AutoMapper;
import com.vhuomai.system.entity.BaseSysMerchant;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * @author harris
 */
@Mapper
public interface MerchantMapper extends AutoMapper<BaseSysMerchant, Integer> {

    BaseSysMerchant findByMerchantNo(@Param("merchantNo") Integer merchantNo);
    
    BaseSysMerchant findByDomain(@Param("domain") String domain);
    
    @Insert("insert into base_sys_merchant(merchant_no,forbidden,create_time,update_time)" +
        " values (SELECT IFNULL(max(merchant_no), 11000) FROM base_sys_merchant,#{forbidden},#{createTime},#{updateTime})")
    void insertOne(BaseSysMerchant merchant);
}
